package pl.edu.pw.ee.buildcity.dao;

import javax.persistence.EntityNotFoundException;
import java.util.List;
import java.util.Map;

/**
 * @author mgrzechocinski
 * @since 2009-09-20
 */
public interface GenericDao<T, K> {

	public abstract T persist(T entityToPersist);

	public abstract void remove(T objectToBeDeleted);

	public abstract T merge(T entityToPersist);

	public abstract List<T> executeQuery(String jpaqlQuery);

	public abstract List<T> executeQuery(String jpaqlQuery, Map<String, Object> params);

	public abstract T getSingleResultOfQuery(String jpaqlQuery) throws EntityNotFoundException;

	public abstract T getSingleResultOfQuery(String jpaqlQuery, Map<String, Object> params);

	public abstract List<T> executeNamedQuery(String queryName);

	public abstract List<T> executeNamedQuery(String queryName, Map<String, Object> params);

	public abstract List<T> executeNamedQuery(String queryName, Map<String, Object> params, int maxResults);

	public abstract T getSingleResultOfNamedQuery(String queryName) throws EntityNotFoundException;

	public abstract T getSingleResultOfNamedQuery(String queryName, Map<String, Object> params) throws EntityNotFoundException;

	public abstract T getById(Class<T> entity, K key);
}
